package Control.tools
{
	import Control.BroadMessageCenter;
	import Control.LoaderAssetsEvent;
	
	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.net.URLRequest;
	import flash.system.ApplicationDomain;
	import flash.system.LoaderContext;

	public class LoadAssets
	{
		public static var instance:LoadAssets;
		public function LoadAssets(p:Private)
		{
			
		}
		public static function getInstance():LoadAssets
		{
			if(!instance)
			{
				instance=new LoadAssets(new Private());
			}
			return instance;
		}
		public  function loadAssetsByUrl(_url:String):void
		{
			var load:Loader=new Loader();
			var loaderContext:LoaderContext=new LoaderContext(false,ApplicationDomain.currentDomain);
			load.contentLoaderInfo.addEventListener(Event.COMPLETE,onCompleteLoadAssets);
			load.load(new URLRequest(_url),loaderContext);
			function onCompleteLoadAssets(e:Event):void
			{
				var ev:LoaderAssetsEvent=new LoaderAssetsEvent(LoaderAssetsEvent.loadAssets_complete);
				ev.data=load;
				BroadMessageCenter.getInstance().sendEvent.dispatchEvent(ev);
			}
		}
	}
}
class Private
{
	
}